package org.jeecg.modules.wms.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.wms.entity.FinishedGoodsOutbound;

import java.util.List;
import java.util.Map;

/**
 * 成品出库单Service接口
 */
public interface IFinishedGoodsOutboundService extends IService<FinishedGoodsOutbound> {

    /**
     * 分页查询成品出库单列表
     */
    IPage<FinishedGoodsOutbound> queryOutboundList(Page<FinishedGoodsOutbound> page, FinishedGoodsOutbound query);

    /**
     * 根据客户ID查询出库单列表
     */
    List<FinishedGoodsOutbound> queryByCustomerId(String customerId);

    /**
     * 根据状态查询出库单列表
     */
    List<FinishedGoodsOutbound> queryByStatus(Integer status);

    /**
     * 统计出库单数量
     */
    Long countByStatus(Integer status);

    /**
     * 生成出库单号
     */
    String generateOutboundNo();

    /**
     * 提交审核
     */
    boolean submitForAudit(String id, String submitterId);

    /**
     * 审核出库单
     */
    boolean auditOutbound(String id, Integer auditResult, String auditRemark, String auditorId, String auditorName);

    /**
     * 取消出库单
     */
    boolean cancelOutbound(String id, String reason, String operatorId, String operatorName);

    /**
     * 创建出库单及明细（事务安全）
     * @param outbound 出库单对象（包含明细列表）
     * @return 出库单ID
     */
    String createOutboundWithDetails(FinishedGoodsOutbound outbound);

    /**
     * 一键出库
     * @param outboundId 出库单ID
     * @param userId 操作用户ID
     * @param userName 操作用户名
     * @return 执行结果
     */
    boolean oneClickOutbound(String outboundId, String userId, String userName);

    Result<String> deleteById(String id);
}
